package com.hao.rabbitmqconsumer.config;

import org.springframework.amqp.core.*;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

//@Configuration
public class DelayMessageConfig {

    @Bean
    public DirectExchange delayDirectExchange(){
        return ExchangeBuilder
                .directExchange("delay.direct")
                .delayed()
                .durable(true)
                .build();
    }

    @Bean
    public Queue delayQueue(){
        return new  Queue("delay.queue");
    }
//    @Bean
//    public Binding delayBinding(@Qualifier("delayQueue") Queue queue,@Qualifier("delayDirectExchange") Exchange exchange){
//        return BindingBuilder.bind(queue()).to(exchange()).with("delay");
//    }
}
